var str = "      dsf";
var res = str.replace(/^\s/.exec(str)[0],"");
console.log(res);